class CreateArticles < ActiveRecord::Migration
  def self.up
    create_table :articles do |t|
			t.string :title, :null=>false
			t.string :slug
			t.text :content
			t.integer :category_id, :null=>false
			t.integer :user_id, :null=>false
      t.timestamps
    end

		add_index :articles, [:user_id], :name=>"fk_user"
    add_index :articles, [:category_id], :name=>"fk_category"
  end

  def self.down
    drop_table :articles
  end
end
